<?php
class UsuarioForm extends ModelFormHelper
{
    public function  __construct()
    {
        parent::__construct(Doctrine::getTable("Usuarios"));
        $this->availableFields = array("usrid", "usrusuario", "usrcontrasena",
            "usrisadm");
        //Event Handlers
        $this->FieldBinding = $this->FieldDataBinding();
        $this->FieldBound = $this->FieldDataBound();
    }
    //Set the properties before to create the control
    protected function FieldDataBinding()
    {
        return function($control, FieldBindingEventArgs $eventArgs)
        {
            switch($eventArgs->fieldName)
            {
                case "usrcontrasena":
                    $eventArgs->fieldProps["type"] = "password";
                    break;
            }
        };
    }
    //Set the properties for the control created
    protected function FieldDataBound()
    {
        return function($control, $fieldName)
        {
            switch($fieldName)
            {
                case "usrcontrasena":
                    $control->setLabel("Contrase&ntilde;a:");
                    break;
                case "usrusuario":
                    $control->setLabel("Usuario:");
                    break;
                case "usrid":
                    $control->setLabel("ID:");
                    break;
                case "usrisadm":
                    $control->setLabel("Es Admin?");
                    break;
            }
        };
    }
    protected function OnPreRender() {}
    public function save()
    {

    }
}
?>